package cn.edu.tju.elm.mapper;

import cn.edu.tju.elm.dto.StarCreateDTO;
import cn.edu.tju.elm.dto.StarResponseDTO;
import cn.edu.tju.elm.dto.StarUpdateDTO;
import cn.edu.tju.elm.model.Star;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * ClassName: StarMapper
 * Package: cn.edu.tju.elm.mapper
 * Description:
 *
 * @Author Niu Wenhang
 * @Create 2025/9/20 11:43
 * @Version 1.0
 */
@Mapper(componentModel = "spring")
public interface StarMapper {
    @Mapping(target = "business.id", source = "businessId")
    Star createDtoToStar(StarCreateDTO dto);

    @Mapping(target = "userId", source = "user.id")
    @Mapping(target = "businessId", source = "business.id")
    StarResponseDTO starToResponseDTO(Star star);

    List<StarResponseDTO> starsToResponseDTOs(List<Star> stars);

    @Mapping(target = "business.id", source = "businessId")
    Star updateDtoToStar(StarUpdateDTO dto);
}
